using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace ZDT.Common
{
    public class Down
    {
        public static void DownFile(string strImageURL, string filePath)
        {
            //string strImageURL = "http://192.168.0.1:88/VDirA/images/1.jpg";
            System.Net.WebClient webClient = new System.Net.WebClient();
            webClient.DownloadFile(strImageURL, filePath);
        }
        public static System.IO.Stream DownStream(string strImageUrl)
        {
            System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strImageUrl);
            webRequest.Method = "GET";
            System.Net.HttpWebResponse webResponse = (System.Net.HttpWebResponse)webRequest.GetResponse();

            System.IO.Stream stream = webResponse.GetResponseStream();
            return stream;
        }
        //public static Image File2Image2(string filePath)
        //{
        //    var result = Image.FromFile(filePath);
        //    return result;
        //}
        //public static Image File2Image(string filePath)
        //{
        //    FileStream fs = System.IO.File.OpenRead(filePath);
        //    var result = Image.FromStream(fs);
        //    fs.Close();
        //    return result;
        //}
    }
}
